import { log } from 'console';
import pino from 'pino'
import pinoHttp from "pino-http";

const transport = pino.transport({
    targets: [
        {
            target: 'pino/file',
            options: {
                destination: 'logs/server.log',
                mkdir: true,
                append: false

            }
        },
        {
            target: 'pino-pretty',
            options: {
                colorize: true,
                // hideObject: true,
                // messageFormat: true,
                translateTime: "UTC:yyyy-mm-dd HH:MM:ss.l o"
            }
        }

    ]
})



export const logger = pinoHttp({
    base: undefined,
    autoLogging: false,
    customLogLevel: function (req, res, err) {
        if (res.statusCode !== 200) {
            return 'error'
        }
        return 'info'
    },
    quietReqLogger: true,
    quietResLogger: true
}, transport)

